package com.liliudong.pinkyponk.api.admin.configuration;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.liliudong.pinkyponk.api.admin.interceptor.PinkyPonkDataPermissionInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * InterceptorConfig
 *
 * @author liliudong
 * @date 2022-05-26 19:14
 **/
@Configuration
public class MybatisInterceptorConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        mybatisPlusInterceptor.addInnerInterceptor(new PinkyPonkDataPermissionInterceptor());
        return mybatisPlusInterceptor;
    }
}
